package org.hq.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.hq.sql.SqlManageService;
import org.hq.sql.entity.VideoSelect;
import org.hq.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 视频详询信息  前端控制器
 * </p>
 *
 * @author 来一炮
 * @since 2024-09-14
 */
@RestController
@RequestMapping("/videoMessage")
public class VideoMessageController {
    @Autowired
    private SqlManageService sqls;

    @GetMapping("/index&pageNum={pageNum}&&pageSize{pageSize}")
    public R<Object> index(@PathVariable String pageNum, @PathVariable String pageSize) {
        int IpageNum = 0;
        int IpageSize = 0;
        try {
            IpageNum = Integer.parseInt(pageNum);
            IpageSize = Integer.parseInt(pageSize);

        } catch (Exception e) {
            System.out.println("pageNum:" + pageNum + " pageSize:" + pageSize);
        }

        Page<VideoSelect> page = null;
        if (IpageNum > 0 && IpageSize > 0) {
            page = sqls.pageAllVideoSelect(IpageNum, IpageSize);
        } else {
            page = sqls.pageAllVideoSelect(1, 200);
        }
        System.out.println(IpageNum);
        return R.ok(page);
    }

}
